package com.example.springtransdemo.Controller;

import com.example.springtransdemo.Service.LogService;
import com.example.springtransdemo.Service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("/user3")
public class UserController3 {
    @Autowired
    private UserService userService;
    @Autowired
    private LogService logService;
    @Transactional
    @RequestMapping("/r1")
    public String r1(String username, String password) {
        userService.insertLog(username,password);
        log.info("用户注册成功");
        logService.insertLog(username,"用户注册");
        return "success";
    }
}
